﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

namespace Library.Test.Logic
{
    /// <summary>
    /// 多线程测试
    /// </summary>
    public class ThreadTestService
    {

        /// <summary>
        /// 单线程测试
        /// </summary>
        public void SingleThread() {

            var sw = Stopwatch.StartNew();
            sw.Start();//开始计时

            sw.Stop();
            Console.WriteLine($"单线程测试完成，耗时{sw.ElapsedMilliseconds}毫秒");
        }


        /// <summary>
        /// 并行测试
        /// </summary>
        public void ParallelThread()
        {

            var sw = Stopwatch.StartNew();
            sw.Start();//开始计时


            sw.Stop();
            Console.WriteLine($"并行测试完成，耗时{sw.ElapsedMilliseconds}毫秒");
        }
    }
}
